const DEMO_UPLOAD_API = "https://nextjs-upload-service.vercel.app/api/upload";
export const upload = async (file: File) => {
  try {
    const body = new FormData();
    body.append("source", file);
    const resp = await fetch(DEMO_UPLOAD_API, {
      method: "POST",
      body,
    });
    const json = await resp.json();
    return json.image;
  } catch (error) {
    return { url: `demo_path/${file.name}` };
  }
};

export const demoData = [
  {
    url: "https://img.yzcdn.cn/vant/sand.jpg",
    filename: "图片名称",
  },
  {
    url: "https://img.yzcdn.cn/vant/tree.jpg",
    filename: "图片名称",
  },
];
